/*
 ============================================================================
 Name		: DaMaiModel.h
 Author	  : Gary
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CDaMaiModel declaration
 ============================================================================
 */

#ifndef DAMAIMODEL_H
#define DAMAIMODEL_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>

#include "DaMaiWebClientEngine.h"
#include "DaMaiCommon.h"

 class MReceiveObserver
 {
     public:
         /**
          *  Called when timer request completed
          */
         virtual void CitysReceived(RArray<TCity>& aArray) = 0;
         
         
         virtual void ExhibitionHallsReceived(RArray<TExhibitionHall>& aArray) = 0;
         
         virtual void ExhibitionHallItemsReceived(RArray<TExhibitionHallItem>& aArray) = 0;
         
         
 };
// CLASS DECLARATION

/**
 *  CDaMaiModel
 * 
 */
class CDaMaiModel : public CBase,MClientObserver
	{
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CDaMaiModel();
	/**
	 * Two-phased constructor.
	 */
	static CDaMaiModel* NewL();

	/**
	 * Two-phased constructor.
	 */
	static CDaMaiModel* NewLC();
	
	
	//城市 
	void GetCitys();
	
	//展馆
	void GetExhibitionHalls(TInt64 id);
	
	
	//展馆详细
	void GetExhibitionHallDetails(TInt64 id);

	// ---------------------------------------------------------
	// Set observer.
	// ---------------------------------------------------------
	//
	void SetObserver(MReceiveObserver* aObserver);
	
private:

	/**
	 * Constructor for performing 1st stage construction
	 */
	CDaMaiModel();

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL();
	
	
	/*
	* ClientEvent()
	*
	* Called when event occurs in CClientEngine.
	*
	* Params:
	*		aEventDescription:	A event in textual format, e.g.
	*							"Transaction Successful"
	*
	* Returns:
	* 		-
	*
	*/
	void ClientEvent(const TDesC& aEventDescription);

	/*
	* ClientBodyReceived()
	*
	* Called when a part of the HTTP body is received.
	*
	* Params:
	*		aBodyData:	Part of the body data received. (e.g. part of
	*					the received HTML page)
	*
	* Returns:
	* 		-
	*
	*/
	//当引擎接收到响应数据，调用该方法通知使用者
	void ClientBodyReceived(const TDesC8& aBodyData);
	
	
	
	//数据类型
	enum
	{
	 ECity,
	 EExhibitionHall,
	 EExhibitionHallItem
	};
	
	
private:
	CDaMaiWebClientEngine* iClient;//http get引擎
	
	TInt iGetDataType;//当前获取的数据类型

	MReceiveObserver* iObserver;
	};

#endif // DAMAIMODEL_H
